#include <iostream>
#include "mgr/LogMgr.h"

int LogMgr::Init(const std::string& conf_file) {
    _logger = new Logger("log/log");
	return 0;
}

void LogMgr::Run() {
	m_thread = std::thread(&LogMgr::_Run, this);
}

void LogMgr::_Run(){
	while (!m_exit)
	{
        SyncFunctor functor;
        bool ret = m_logs.Pop(functor);
        while(ret)
        {
            functor();
            ret = m_logs.Pop(functor);
        }
		std::this_thread::sleep_for(std::chrono::milliseconds(10));
	}
}